﻿using System;
using System.Collections.Generic;
using GalaxyTranslator.EntityDataModel;
using GalaxyTranslator.Presenters;
using GalaxyTranslator.ViewInterfaces;

namespace GalaxyTranslator.Admin
{
	public partial class WebForm9 : System.Web.UI.Page, IAdminRegistration
	{	
		private AdminRegPresenter _presenter;

		public string UserName
		{
			get { return TextBox1.Text; }
		}

		public string Password
		{
			get { return TextBox2.Text; }
		}

		public int RoleId
		{
			get { return int.Parse(roles.SelectedValue); }
		}

		public IList<Role> Roles
		{
			set 
			{
				roles.DataSource = value;
				roles.DataBind();
			}
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			InitView();
		}

		private void InitView()
		{
			_presenter = new AdminRegPresenter(this);
			_presenter.InitView(IsPostBack);
		}

		protected void Button1_Click(object sender, EventArgs e)
		{
			_presenter.Register();
		}


	}
}